II Something
by Clark Hugh Stiles
February 6, 2002 

I have the DVD of the movie 2010 setting on a pile of stuff I'm trying to sell online. That movie is quite dated, but has a curiousity item -- the Heywood Floyd character uses an Apple IIc with LCD display on the beach at one point. At the time the movie was made, the LCD display had not been seen outside of Apple's lab, and was rare even by the time the movie was released. Some would say that it never quite arrived. 

Since I'd never tried the following with any DVD, I stuck it in the CD drive of the iMac. I was curious to learn whether DVD disks showed up as blank CDs, or as nothing at all, or what. I got a warning dialog that the disk was unreadable, and would I like to format it. The only formatting option available was "ProDOS 0K". 

I still haven't completed the block editor program, but I will, any day now. I've been working more and haven't had the time to do it. Also I'm an internet addict, which is something you may not have known. I'll try to explain the INFO command, as I mentioned I'd do back in mid-November. We'll start with the loader routine which is used once and then basically discarded. 
Listing One: 
2000: 38 SEC
2001: A9 22 LDA #22
2003: E9 21 SBC #21
2005: 8D C4 20 STA 20C4
2008: EE C4 20 INC 20C4
200B: AD C4 20 LDA 20C4
200E: 20 F5 BE JSR BEF5
2011: 90 05 BCC 2018 {+05} 
End of Listing. 
That's the Gary Little routine for reserving memory. At $2001 we load the memory page MSB for the last page (it's a two page program), subtract that from the MSB for the first page, and store that. That value is then incremented and loaded into the Accumulator, the Basic.System routine to reserve the memory is called, and if no errors are returned, we hop over to $2018. The intervening code: 
Listing Two: 
2013: A9 0E LDA #0E
2015: 4C 09 BE JMP BE09 
End of Listing. 
is just the error handler. Most of the time the only condition that is in error is that no memory pages are available. 
Listing Three: 
2018: 8D C5 20 STA 20C5
201B: AD 07 BE LDA BE07
201E: 8D 26 22 STA 2226
2021: AD 08 BE LDA BE08
2024: 8D 27 22 STA 2227
2027: A2 00 LDX #00
2029: 8E 07 BE STX BE07 
End of Listing. 
The value yielded by the memory reservation routine is the first page of the range requested. The requested pages are always contiguous, unless you build a very sophisticated page-by-page loader for some reason only familiar to you. Freak. Anyway, the value is stored in scratch space at the end of the loader routine. Beginning at $201B and ending with $2029 the previous pointer to the external command (if any) is stored within the jump at $2225 (soon to be relocated). Our command is now first in line, and will remain there unless some other command is installed thereafter. 
Listing Four: 
202C: AE C5 20 LDX 20C5
202F: E8 INX
2030: 8E 08 BE STX BE08
2033: AE C5 20 LDX 20C5
2036: 8E 9A 21 STX 219A
2039: 8E 0F 22 STX 220F
203C: 8E 1A 22 STX 221A
203F: E8 INX
2040: 8E 58 21 STX 2158
2043: 8E 66 21 STX 2166 
End of Listing. 
At $202C we retrieve the value stored by line $2018 and store that in a few places within the actual command program itself. These patches are necessary for the hard JMP and JSR instructions found in the program, because the code will soon be relocated to the two memory pages we reserved up above. Reserving memory just means that a disk operation like LOAD or BLOAD (or OPEN, or CATALOG) won't overwrite it. 
Listing Five: 
2046: A9 00 LDA #00
2048: 85 3C STA 3C
204A: A9 21 LDA #21
204C: 85 3D STA 3D
204E: A9 FE LDA #FE
2050: 85 3E STA 3E
2052: A9 22 LDA #22
2054: 85 3F STA 3F
2056: A9 00 LDA #00
2058: 85 42 STA 42
205A: AD C5 20 LDA 20C5
205D: 85 43 STA 43
205F: A0 00 LDY #00
2061: 20 2C FE JSR FE2C 
End of Listing. 
Listing Five performs the actual relocation. The INFO command, neatly patched, gets moved from $2100.22FE to the reserved memory pages. As I mentioned, the pages can be requested one by one and the pages patched appropriately, then moved one by one, but I can't think of any good reason to do it that way. If this were a program like AppleWorks, with massive program segments squirrelled away all over, then yes, a more sophisticated loader routine would be necessary. 
Listing Six: 
2064: 20 8E FD JSR FD8E
2067: A0 00 LDY #00
2069: B9 75 20 LDA 2075,Y
206C: 20 ED FD JSR FDED
206F: C8 INY
2070: C0 4F CPY #4F
2072: D0 F5 BNE 2069 {-0B}
2074: 60 RTS
2075: C9 CE C6 CF A0 E3 EF ED ED E1 EE- INFO comman
2080:E4 A0 F6 E5 F2 F3 E9 EF EE A0 B2 A0 E2 F9 A0 C3-d version 2 by C
2090:AE C8 AE D3 F4 E9 EC E5 F3 8D 8D C9 CE C6 CF A0-.H.Stiles..INFO
20A0:DB F0 E1 F4 E8 EE E1 ED E5 DD DB AC D4 DD DB AC-[pathname][,T][,
20B0:C1 DD DB AC CC DD DB AC D6 DD DB AC D3 DD DB AC-A][,L][,V][,S][,
20C0:C4 DD 8D 8D 00 00 00 00 00 00 00 00 00 00 00 00-D]..............
20D0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00-................
20E0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00-................
20F0:00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00-................ 
End of Listing. 
Line $2064 calls a ROM routine that generates a carriage return, then prints the message showing the INFO command has loaded and what its syntax is. In another version I had the loader to check for the use of the V parameter, and if found (greater than zero) to not print the message. Beats me why that's not in here. It's just a matter of checking $BE68 and skipping the printing of the message if found. There's plenty of room left in there. 

Next issue will look at the third page, which is the parser routine, unless I get lazy and just revise Listing Six above to add the check for the V paramter. By the time we look at the second page, which is the actual command itself, I should be more or less back on schedule. 

II Infinitum! ...[Message truncated] 